<?php
namespace app\api\controller\Common;

use app\api\controller\Base;
use app\api\controller\Baseuser;

use app\common\model\user\Setting;
use think\facade\Request;

class Common extends Base
{
    // 查询设置参数
    public function getSetting()
    {
        $title =  Request::instance()->param('title');
        $data = (new Setting())->getSetting($title);
        if ($data) {
            $data['Content'] = json_array($data['Content'], true);
        }
        return myok($data);
    }

    // 修改参数
    public function saveSetting()
    {
        $params =  Request::instance()->param();

        $res = (new Setting())->saveData($params);
        if (is_array($res)) {
            return myok('设置成功');
        } else {
            return myerr($res);
        }

    }

}
